package top.gohigh.springboot.service.impl;

import org.springframework.stereotype.Service;
import top.gohigh.springboot.dao.UserGroupDao;
import top.gohigh.springboot.model.UserGroup;
import top.gohigh.springboot.service.UserGroupService;

import javax.annotation.Resource;

@Service
public class UserGroupServiceImpl implements UserGroupService {
    @Resource
    UserGroupDao userGroupDao;

    @Override
    public UserGroup addGroup(String name) {
        UserGroup userGroup=new UserGroup();
        userGroup.setName(name);
        userGroupDao.save(userGroup);
        return userGroup;
    }

    @Override
    public UserGroup findById(Long id) {
       return userGroupDao.findById(id).get();
    }
}
